[LINUX] Oney 'nosmp' and 'max_cpus=' command line options.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 14 Aug 2006 15:12:43 +0000 (16:12 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 14 Aug 2006 15:12:43 +0000 (16:12 +0100)
Based on a patch from Jan Beulich.
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/drivers/xen/core/smpboot.c

index 71990e04d577b82fb7ad8b5b0333decf81cfe868..2538791d0edd6a43d935f459b2733ea8bbc4aeca 100644 (file)
@@ -255,7 +255,14 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 
        xen_smp_intr_init(0);
 
-       for_each_cpu_mask (cpu, cpu_possible_map) {
+       /* Restrict the possible_map according to max_cpus. */
+       while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) {
+               for (cpu = NR_CPUS-1; !cpu_isset(cpu, cpu_possible_map); cpu--)
+                       continue;
+               cpu_clear(cpu, cpu_possible_map);
+       }
+
+       for_each_cpu (cpu) {
                if (cpu == 0)
                        continue;
 
@@ -266,7 +273,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 #endif
                gdt_descr->address = get_zeroed_page(GFP_KERNEL);
                if (unlikely(!gdt_descr->address)) {
-                       printk(KERN_CRIT "CPU%d failed to allocate GDT\n", cpu);
+                       printk(KERN_CRIT "CPU%d failed to allocate GDT\n",
+                              cpu);
                        continue;
                }
                gdt_descr->size = GDT_SIZE;
@@ -305,12 +313,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 
        init_xenbus_allowed_cpumask();
 
-       /* Currently, Xen gives no dynamic NUMA/HT info. */
-       for (cpu = 1; cpu < NR_CPUS; cpu++) {
-               cpu_sibling_map[cpu] = cpumask_of_cpu(cpu);
-               cpu_core_map[cpu]    = cpumask_of_cpu(cpu);
-       }
-
 #ifdef CONFIG_X86_IO_APIC
        /*
         * Here we can be sure that there is an IO-APIC in the system. Let's